import { Entity, Column, PrimaryGeneratedColumn } from "typeorm";
import dayjs from "dayjs";

@Entity({ name: "todos" })
export class TestEntity {
  @PrimaryGeneratedColumn()
  id!: number;

  @Column({
    type: "varchar",
    length: 50,
    nullable: false,
    comment: "名字",
  })
  name!: string;

  @Column({
    type: "boolean",
    nullable: false,
    default: false,
    comment: "是否完成",
  })
  complete!: boolean;

  @Column({
    type: "varchar",
    length: 20,
    nullable: false,
    default: dayjs().format("YYYY-MM-DD HH:mm:ss"),
    comment: "创建时间",
  })
  createTime!: string;

  @Column({
    type: "varchar",
    length: 20,
    nullable: false,
    default: dayjs().format("YYYY-MM-DD HH:mm:ss"),
    comment: "更新时间",
  })
  updateTime!: string;
}
